using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;

using OrbitOne.Feed.Domain;
using OrbitOne.Feed.Interfaces;

namespace OrbitOne.Feed.DummyFeedLoader {
    public class PodcastFeedLoader : IWebFeedDataLoader {

        #region IWebFeedDataLoader Members

        public OrbitOne.Feed.Domain.WebFeed DoLoad() {

            PodCastWebFeed webFeed = new PodCastWebFeed(
            CultureInfo.CreateSpecificCulture("en-us"), // The language in which this feed is in
            "Podcast channel title", // the title of the podcast channel 
            DateTime.Now, // Last update datetime
            new Uri("http://mysite.com"), // Url of the website hosting the podcast channel
            "Podcast feed description"  // Description text of the webfeed
            );
            // optional stuff ... 
            webFeed.Author = new Author("feed authorname", "feedauthor@server.com");
            webFeed.Owner = new Owner("feed ownername", "feedowner@server.com");
            webFeed.Image = new Uri("http://podcast.ixbt.com/pic/tetka.jpg");
            webFeed.Copyright = "Copyright statement";
            webFeed.SubTitle = "podcast subtitle";
            webFeed.Summary = "podcast summary";
            webFeed.Category = ITunesCategories.Health; // Use predefined categories for ITunes
            webFeed.SubCategory = ITunesCategories.HealthSubcategories.AlternativeHealth; 
            webFeed.KeyWords.Add("keyword1");
            webFeed.KeyWords.Add("keyword2");
            webFeed.Explicity = Explicity.No; // parental guideline indication

            PodCastTopic firstTopic = new PodCastTopic(
            "firstTopic title", // the title of the podcast topic 
            DateTime.Now, // Last update datetime
            "description of first podcast topic", // Description text of the podcast topic
            new Uri("http://mytopicuri.com") // Description text of the podcast topic
            );
            // associate podcast topic with some categories
            firstTopic.Categories.Add(new Category("firstCategory1"));
            firstTopic.Categories.Add(new Category("firstCategory2"));

            firstTopic.Author = new Author("authorname", "author@server.com");
            firstTopic.SubTitle = "podcasttopicsuntitle";
            firstTopic.Duration = new TimeSpan(0, 5, 10);
            firstTopic.Explicity = Explicity.No;
            firstTopic.KeyWords.Add("topickw1");

            Int64 contentLength = 5650889;
            Content content = new Content(
            new Uri("http://www.kuow.org/mp3high/mp3/news/061012_cd_veggies.mp3"), // url of the podcast content
            contentLength, // length of podcast
            MimeTypes.mp3 // mime type of the podcast
            );

            firstTopic.Content = content; 
            webFeed.Topics.Add(firstTopic);

            PodCastTopic secondTopic = new PodCastTopic(
            "title2", 
            DateTime.Now.AddDays(-1), 
            "TopicDescription2", 
            new Uri("http://mytopicuri.com"));
            secondTopic.Categories.Add(new Category("firstCategory1"));

            contentLength = 5650889;
            Content secondContent = new Content(
            new Uri("http://podcast.coasterbuzz.com/mp3/coasterbuzzpodcast050.mp3"), // url of the podcast content
            contentLength, // length of podcast
            MimeTypes.mp3 // mime type of the podcast
            );

            secondTopic.Content = secondContent;
        
            Author author2 = new Author("authorname", "me@server.com");
            secondTopic.Author = author2;

            webFeed.Topics.Add(secondTopic);

            return webFeed;
        }

        #endregion
    }
}
